
#ifndef MESH_H
#define MESH_H

#include"object.h"
#include"ray.h"
#include"vshape.h"
#include"box.h"

//typedef class BBox TD_BBox;
class BBox;

class Mesh: public Object
{
  private:
  VShape * shape;
  BBox * box;
  float * vertices;
  float * normals;
  int box_h;
  unsigned int * triangles;
  bool TriangleHit (Ray * ray, int t_id, float * t_p,  float * t_d);
  bool Hit_aux (Ray * ray, BBox * bx, float* t_p, float* t_d);
  void Init ();
  public:
  Mesh(int b_h): shape(NULL), box(NULL), box_h(b_h){};
  bool Hit (Ray * ray);
  
  void ShapeFromFile(const char * filename);
  void ShapeSphere (int n);
  void ShapeTorus(int n);
};



#endif
